package com.howells.time.module.comment.view;

import android.content.Context;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;

import com.howells.time.R;
import com.howells.time.base.activity.BaseActivity;
import com.howells.time.base.utils.ToastShow;
import com.howells.time.module.comment.presenter.CommentPresenter;
import com.howells.time.module.comment.presenter.CommentPresenterImp;

public class CommentActivity extends BaseActivity implements CommentView {

    private CommentPresenter mCommentPresenter;
    private EditText mEditText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_comment);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setNavigationIcon(R.drawable.login_header_back_normal);
        toolbar.setTitle("评论");
        toolbar.inflateMenu(R.menu.activity_comment_menu);

        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                switch (item.getItemId()) {
                    case R.id.btn_send:
                        ToastShow.ToastShort(CommentActivity.this, "发送");
                        break;
                    default:
                        break;
                }
                return false;
            }
        });
        mEditText = (EditText) findViewById(R.id.editText_multiline);
        InputMethodManager inputManager =
                (InputMethodManager) mEditText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        inputManager.showSoftInput(mEditText, 0);
        mCommentPresenter=new CommentPresenterImp(this);
    }

    public void onClick(View view) {

    }

    @Override
    public void resultMsg(String msg) {
        ToastShow.ToastShort(this,msg);
    }

    @Override
    public void sendSuccess(String msg) {

    }

    @Override
    public void sendFail(String msg) {

    }
}
